package com.tanglongan.concurrent._basic;

public class Demo13 {
    public static void main(String[] args) throws InterruptedException {
        Demo13Thread t = new Demo13Thread();
        t.start();
        Thread.sleep(2000);
        t.stop();  //方法已经被注明“已过时”
    }
}

class Demo13Thread extends Thread {

    @Override
    public void run() {
        try {
            while (true) {
                System.out.println("time=" + System.currentTimeMillis());
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ThreadDeath e) {
            System.out.println("进入ThreadDeath异常块");
            e.printStackTrace();
        }
    }

}